package top.mcwebsite.playandroid.common.network.impl

import top.mcwebsite.playandroid.common.network.NetworkApiException
import top.mcwebsite.playandroid.common.network.api.NetworkService
import top.mcwebsite.playandroid.common.network.noInternet
import top.mcwebsite.playandroid.common.network.timeout
import top.mcwebsite.playandroid.common.network.unknown
import top.mcwebsite.playandroid.lib.servicemanager.core.ServiceManager
import java.net.SocketTimeoutException

fun NetworkApiException.Companion.transform(source: Throwable): NetworkApiException {

    return when (source) {
        is SocketTimeoutException -> NetworkApiException.timeout(source)
        else -> {
            NetworkApiException.unknown(source)
        }
    }
}